﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Model;
using BLL;

namespace EstateappraisalApi.Controllers
{
    /// <summary>
    /// 小区状况
    /// </summary>
    public class VillageController : ApiController
    {
        
        VillageBLL bll = new VillageBLL();

        // GET api/village
        /// <summary>
        /// 查找对应项目的小区状况信息
        /// </summary>
        /// <param name="projectNumber"></param>
        /// <returns></returns>
        public IEnumerable<Village> Get(string projectNumber)
        {
            return bll.ShowVillage(projectNumber);
        }

        // GET api/village/5
        public string Get(int id)
        {
            return "value";
        }

        // POST api/village
        /// <summary>
        /// 添加小区状况信息
        /// </summary>
        /// <param name="value"></param>
        public int Post([FromBody]Village m)
        {
            m.village_CreatePeople = "1";
            m.village_CreateTime = DateTime.Now;
            if (bll.AddVillage(m))
            {
                return 1;
            }
            else
            {
                return 0;
            }

        }

        // PUT api/village/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/village/5
        public void Delete(int id)
        {
        }
    }
}
